Save File Contents to Variable in Python3.3 [migrated]
Posted
by
Neo_Programmer
on Programmers
See other posts from Programmers
or by Neo_Programmer
Published on 2012-12-17T13:53:50Z
Indexed on
2012/12/17
17:13 UTC
Read the original article
Hit count: 202
I have a Python3.3 script that seems to not work. The script will search for an XML pattern and then print the results to the screen. I am using Ubuntu 12.10 (AMD64) and python3.3. I prefer to use regex with XML, so please disregard this unconventional form of programming.
#!/usr/bin/python3.3
import io, re
openfile = open('./temp/xaiml/temp_db1.xaiml', 'r')
TEMPDB = openfile.read()
OUTPUT = print(''.join(re.findall('<cgy><prn>.*_.*<\/prn>.*<\/cgy>', TEMPDB, flags=re.I)))
© Programmers or respective owner